/*
Note: Code to reproduce Figure 6 and C.1 and Table C.3

VARIABLES
fg: Focus group #
pre_gnl: I think gendern in the language is the right thing to do (pre)
post_gnl: I think gendern in the language is the right thing to do (post)
mut_int: Participants listened to each other with mutual interest
accepted: I felt accepted in the group
repeat: I would discuss political topics with this group again
good_atm: Overall, the was a good atomosphere in the group
pidst: How close do you feel to this party?
inc: Net monthly income
scholz: Overall, Chancellor Olf Scholz does a good job
party: If there would be a Federal Election next Sunday, which party would you vote for
*/

*Load focus_group_survey_data.dta


set scheme white_tableau

*Collapse GNL support pre/post group discussions
ge catpost=post_gnl
ge catpre=pre_gnl
recode catpre catpost (3=2) (4/7=3)
lab def cat 1"Strongly against (1)" 2"Against (2-3)" 3"Support (4-7)", replace
lab val catpre catpost cat

*Paired t-test of GNL pre/post
ttest post == pre
	   
*Figure 6a
gen pr_off2 = pre - 0.2 // workaround to offset bars
twoway (hist pr_off, discrete freq lcolor(gs3) width(0.5) fcolor(gs3) lcolor(gs3) xlabel(1(1)7,nogrid) text(4.4 2.9 "{it:M{subscript:pre}} = 2.96", color(gs3))) ///
       (hist post, discrete freq lcolor(gs11) width(0.5) fcolor(gs11%60) lcolor(gs11) text(11 1.95 "{it:M{subscript:post}} = 2.17", color(gs11))), ///
	   xtitle("GNL support", size(medsmall)) ytitle("{bf:(A)} Number participants") legend(order(1 "Pre-goup" 2 "Post-group") row(2) ring(0) position(3) yoffset(12) subtitle("Distribution", size(small)) region(ls(grid_major))) ///
	   title("{it:M{subscript:post}-M{subscript:pre}} = -0.79 ({it:p=.027})",size(med) yoffset(-1) ) graphregion(lc(black) margin(tiny)) scale(1.2) name(prep, replace) xsize(6) ysize(5)

*Figure 6b
graph bar accepted repeat good mut_int, over(catpost) b1title("GNL support", yoffset(-2) margin(tiny)) scheme(burd) ytitle("{bf:(B)} Average agreement (1-5)") ylabel(,glstyle(minor_grid)) ///
   bar(1,fc(gs13) lc(white)) bar(2,fc(gs9) lc(white)) bar(3,fc(gs3) lc(white)) bar(4,fc(black) fintensity(90) lc(white)) ///
   legend(order(1 "Accepted" 2 "Would repeat" 3 "Good atmosphere" 4 "Interest") row(1) position(12) yoffset(4)) ///
   graphregion(lc(black)) name(atmo, replace) xsize(6) ysize(5)

   
*Figure C.1
ge vote=party
recode vote (6=1) (3=2) (1=3) (2=4) (4=5) (5=6) //SPD, Gr, CDU, FDP, L, Oth

lab def inclb 1 "<500€" 2 "<1000€" 3 "<1500€" 4 "<2000€" 5 "<3000€" 6 "<4000€" 7 ">4000€"
lab val inc inclb

recode pidst (0=0) (5=1) (4=2) (2=4) (1=5)

global histopt "nodraw discrete freq gap(5) color(gs3) fi(100) xlabel(,gstyle(minor) glcolor(black) notick)  ytitle("") xtitle("") ysize(1) horizontal yscale(lc(none)) xscale(lc(none)) graphregion(margin(small)) plotregion(lcolor(black)) " 

twoway hist pidst, ylabel(0 "No" 1"1(Min)" 2"" 3"" 4"" 5"5(Max)", nogrid notick ) $histopt ///
title({bf:PID Strength}, pos(12) size(small)) name(pid ,replace)

twoway hist vote, ylabel(1 "SPD" 2"Greens" 3"CDU" 4"FDP" 5"Left" 6"Other",  nogrid notick ) $histopt ///
title({bf:Vote choice}, pos(12) size(small)) name(vote ,replace)

twoway hist scholz, ylabel(1 "1(Min)" 2"" 3"" 4"" 5"" 6"" 7"7(Max)", nogrid notick ) $histopt  ///
title({bf:Staisfaction Chancelor}, pos(12) size(small)) name(sat ,replace)

twoway hist inc, ylabel(1 "<500" 2 "<1000" 3 "<1500" 4 "<2000" 5 "<3000" 6 "<4000" 7 ">4000", nogrid notick ) $histopt ///
title({bf:Monthly income}, pos(12) size(small)) name(inc ,replace)
				   
graph combine pid vote sat inc, iscale(*1.7) ysize(2.5)		   


*Table C.3
tabstat pre_g post_ accepted repeat good_a mut_int, c(stat) stat(mean sd min max n)

